home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-12-04 | 2.0 KB | 82 lines | [TEXT/KAHL] |
- /******************************************************************************
- CAMIconPane.c
-
- Makes an IconPane behave like a radio button.
-
- SUPERCLASS = CIconPane
-
- Copyright © 1991 Bowers Development Corporation. All rights reserved.
-
-
- ******************************************************************************/
-
- #include "CAMIconPane.h"
- #include "CLabeledGroup.h"
-
- /******************************************************************************
- IViewTemp
-
- Initialize from a template resource.
- ******************************************************************************/
-
- void CAMIconPane::IViewTemp (CView *anEnclosure,
- CBureaucrat *aSupervisor,
- Ptr viewData)
- {
- inherited::IViewTemp (anEnclosure, aSupervisor, viewData);
- isOn = FALSE;
-
- } /* IViewTemp */
-
- /******************************************************************************
- Draw
-
- Draw the icon in response to an update.
- ******************************************************************************/
-
- void CAMIconPane::Draw (Rect *area)
- {
- DrawIcon (isOn);
-
- } /* Draw */
-
-
- /******************************************************************************
- SetRadio
-
- Turn a radio icon on or off
- ******************************************************************************/
-
- void CAMIconPane::SetRadio (Boolean onOrOff)
- {
- if (isOn != onOrOff) {
- isOn = onOrOff;
- Prepare();
- DrawIcon (isOn);
-
- BroadcastChange (radioChanged, &onOrOff); /* notify dependents */
- }
-
- } /* SetRadio */
-
-
- /******************************************************************************
- DoClick
-
- Respond to a click. The wantsClicks instance variable must be
- TRUE for this method ever to be called.
- ******************************************************************************/
-
- void CAMIconPane::DoClick (Point hitPt,
- short modifierKeys,
- long when)
- {
- if (member (itsSupervisor, CLabeledGroup)) {
- SetRadio (TRUE);
- itsSupervisor->DoCommand (GetClickCmd ());
- } else {
- inherited::DoClick (hitPt, modifierKeys, when);
- }
-
- } /* DoClick */
-